#include<bits/stdc++.h>
using namespace std;
const int NN=1e6+4;
vector<int>g[NN];
int du[NN],ans[NN];
int main()
{
	freopen("choice.in","r",stdin);
	freopen("choice.out","w",stdout);
	int n;
	scanf("%d",&n);
	for(int i=1;i<n;i++)
	{
		int u,v;
		scanf("%d%d",&u,&v);
		g[u].push_back(v);
		g[v].push_back(u);
		du[u]++,du[v]++;
	}
	for(int i=2;i<=n;i++)
		du[i]--;
	priority_queue<int>q;
	for(int i=1;i<=n;i++)
		if(!du[i])
			q.push(i);
	for(int i=1;i<=n;i++)
	{
		int u=q.top();
		q.pop();
		ans[i]=u;
		for(int j=0;j<g[u].size();j++)
		{
			int v=g[u][j];
			du[v]--;
			if(!du[v])
				q.push(v);
		}
	}
	for(int i=n;i>=1;i--)
		printf("%d ",ans[i]);
	return 0;
}
